package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum TransactionType {
	
	PAY(0,"购买"),
	REFUND(1,"退款");
	
	private Integer value;
	private String text;

	private TransactionType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static TransactionType toStatus(Integer value) {
		if (PAY.value == value) {
			return PAY;
		} else if (REFUND.value == value) {
			return REFUND;
		}else {
			throw new InvalidArgumentException("Unknown OrderStatus[" + value + "].");
		}
	}
}
